﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace HTComics.Data
{
    public class Admin
    {
        public static void UpdatePriceGuide(string conditionId_1, string bandId, string factor, string varA, string varB)
        {
            string sql = "SP_UPDATE_PRICE_GUIDE @ConditionId_1=" + conditionId_1 + ", @BandId=" + bandId;

            if (!string.IsNullOrEmpty(factor))
                sql += ",@Factor=" + factor;
            else
                sql += ",@Factor=NULL";

            if (!string.IsNullOrEmpty(varA))
                sql += ",@VAR_A=" + varA;
            else
                sql += ",@VAR_A=NULL";

            if (!string.IsNullOrEmpty(varB))
                sql += ",@VAR_B=" + varB;
            else
                sql += ",@VAR_B=NULL";

            Common.GetDataTable(sql);
        }

        public static void UpdateDiscountDetails(string factor, string enabled)
        {
            string sql = "SP_UPDATE_DISCOUNT_DETAILS @Factor=" + factor + ", @Enabled=" + enabled;
            Common.GetDataTable(sql);
        }

        public static void UpdateForexRate(string rate)
        {
            string sql = "SP_UPDATE_FOREX_RATE @Rate=" + rate;
            Common.GetDataTable(sql);
        }

        public static DataTable GetSalesReports(string startDate, string endDate)
        {
            return Common.GetDataTable("SP_SEARCH_ORDERS @START_DATE='" + startDate + "', @END_DATE='" + endDate + "'");
        }
    }
}
